import { http } from "@/utils/http";
import { baseUrlApi } from "../utils";
import { ResultTable } from "../result/result_table";

const basePath = "dingtalk/news";

//列表
export const newsList = (data?: object) => {
  return http.request<ResultTable>("post", baseUrlApi(basePath + ""), {
    data
  });
};

//新增
export const addNews = (data?: object) => {
  return http.request<ResultTable>("post", baseUrlApi(basePath + "/add"), {
    data,
    headers: {
      "Content-Type": "multipart/form-data" // 设置请求头为 multipart/form-data
    }
  });
};

//修改
export const updateNews = (data?: object) => {
  return http.request<ResultTable>("post", baseUrlApi(basePath + "/update"), {
    data,
    headers: {
      "Content-Type": "multipart/form-data" // 设置请求头为 multipart/form-data
    }
  });
};

//删除
export const deleteNews = (data?: object) => {
  return http.request<ResultTable>("post", baseUrlApi(basePath + "/delete"), {
    data
  });
};
